package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DeviceDto;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.entity.DeviceData;
import com.zzyl.vo.DeviceDataVo;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeviceMapper {
    @Select("select count(*) from zzyl.device where device_name=#{deviceName}")
    int queryDevice(String deviceName);

    void insert(Device device);


    Page<DeviceVo> queryPage(@Param("deviceName") String deviceName, @Param("productKey") String productKey, @Param("locationType") Integer locationType);

    DeviceVo queryDeviceDetail(String iotId);

    void queryDevicePropertyStatus(DeviceDto deviceDto);


    void deleteDevice(String iotId);


    void updateDevice(Device device);

    void batchInsert(List<DeviceData> list);

    void deviceOpenDoor(String iotId);

    /**
     * 通过老人查询护理员
     *
     * @param iotId
     * @return 护理员信息
     */
    List<Long> selectNursingIdsByIotIdWithElder(String iotId);

    /**
     * 通过床位查询护理员
     *
     * @param iotId
     * @return 护理员信息
     */
    List<Long> selectNursingIdsByIotIdWithBed(String iotId);

}
